package com.jasonjan.jiance.module.search.main;

import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;

import com.jasonjan.jiance.R;
import com.jasonjan.jiance.global.InitApp;
import com.jasonjan.jiance.module.base.BaseActivity;

public class SearchActivity extends BaseActivity {

    private static final String TAG = "SearchActivity";
    private String flag="";
    private TextView NE_tv;
    private TextView SE_luyou;
    private TextView SE_yuanqu;
    private TextView SE_guangyu;
    private TextView TE_bishi;
    private TextView TE_shangji;

    public static void launch(String flag) {
        InitApp.AppContext.startActivity(new Intent(InitApp.AppContext, SearchActivity.class)
                .putExtra("flag",flag)
                .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_search);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        flag=getIntent().getStringExtra("flag");
        initView();
        initData();
    }

    private void initView(){
        NE_tv=(TextView) findViewById(R.id.NE_tv);
        SE_luyou=(TextView) findViewById(R.id.SE_luyou_tv);
        SE_yuanqu=(TextView) findViewById(R.id.SE_yuanqu_tv);
        SE_guangyu=(TextView) findViewById(R.id.SE_guangyu_tv);
        TE_bishi=(TextView) findViewById(R.id.TE_bishi_tv);
        TE_shangji=(TextView) findViewById(R.id.TE_shangji_tv);
    }

    private void initData(){
        switch (flag){
            case "scoreSearch":{
                setTitle("成绩查询");
                requestInterface(flag);
                break;
            }
            case "feeSearch":{
                setTitle("缴费情况");
                requestInterface(flag);
                break;
            }
            case "examSearch":{
                setTitle("考试进度");
                requestInterface(flag);
                break;
            }
        }
    }

    private void requestInterface(String flag){
        switch (flag){
            case "scoreSearch":{
                NE_tv.setText("NE-上机："+"1000");
                SE_luyou.setText("SE-路由："+"900");
                SE_yuanqu.setText("SE-园区："+"880");
                SE_guangyu.setText("SE-广域："+"700");
                TE_bishi.setText("TE-笔试："+"840");
                TE_shangji.setText("TE-上机："+"900");
                break;
            }
            case "feeSearch":{
                NE_tv.setText("NE-上机："+"已缴费");
                SE_luyou.setText("SE-路由："+"已缴费");
                SE_yuanqu.setText("SE-园区："+"未缴费");
                SE_guangyu.setText("SE-广域："+"已缴费");
                TE_bishi.setText("TE-笔试："+"未缴费");
                TE_shangji.setText("TE-上机："+"已缴费");
                break;
            }
            case "examSearch":{
                NE_tv.setText("NE-上机："+"已完成");
                SE_luyou.setText("SE-路由："+"已完成");
                SE_yuanqu.setText("SE-园区："+"已完成");
                SE_guangyu.setText("SE-广域："+"已完成");
                TE_bishi.setText("TE-笔试："+"未完成");
                TE_shangji.setText("TE-上机："+"未完成");
                break;
            }
        }
    }
}
